package lesson1_20.lesson7;

public class foreach {
    public static void main(String[] args) {
        int data[] = new int[]{2, 3, 5, 6};
        System.out.println("利用数组的脚标进行输出");
        for (int x = 0; x < data.length; x++) {
            System.out.println(data[x]);
        }
        System.out.println("更好的写法: 数据类型 变量:数组名称");
        System.out.println("直接将数组的变量赋值给了变量，所以，打印变量名即可");
        for (int x : data) {
            System.out.println(x);
        }
    }
}
